package cn.zyq.ykb.controller.mgt.task;

import cn.zyq.ykb.beans.task.TaskAudit;
import cn.zyq.ykb.service.task.TaskAuditService;
import cn.zyq.ykb.system.annotation.Log;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.common.PageParam;
import cn.zyq.ykb.system.ry.enums.BusinessType;
import cn.zyq.ykb.system.ry.util.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 任务-审核Controller
 *
 * @author SystemAuth
 * @date 2023-05-22
 */

@RestController(value = "MgtTaskAuditController")
@RequestMapping("/mgt/taskAudit")
@Api(tags = "任务-审核接口")
public class TaskAuditController extends BaseController {

    @Autowired
    private TaskAuditService taskAuditService;

    /**
     * 查询任务-审核列表
     */
    @ApiOperation(value = "列表", response = TaskAudit.class)
    @PreAuthorize("@ss.hasPermi('ykb:taskAudit:list')")
    @PostMapping("/list")
    public Object list(@RequestBody PageParam pageParam) {
        return this.taskAuditService.selectTaskAuditList(pageParam);
    }

     /**
      * 导出任务-审核列表
      */
     @ApiOperation(value = "导出")
     @PreAuthorize("@ss.hasPermi('ykb:taskAudit:export')")
     @Log(title = "任务-审核" , businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, TaskAudit taskAudit) {
         List<TaskAudit> list = taskAuditService.selectTaskAuditList(taskAudit);
         ExcelUtil<TaskAudit> util = new ExcelUtil<TaskAudit>(TaskAudit. class);
         util.exportExcel(response, list, "任务-审核数据");
     }

    /**
     * 获取任务-审核详细信息
     */
    @ApiOperation(value = "详情", response = TaskAudit.class)
    @PreAuthorize("@ss.hasPermi('ykb:taskAudit:query')")
    @GetMapping(value = "/{id}")
    public Object getInfo(@PathVariable("id") Integer id) {
        return this.taskAuditService.selectTaskAuditByTaskAuditID(id);
    }
    /**
     * 获取任务-审核详细信息
     */
    @ApiOperation(value = "详情", response = TaskAudit.class)
    @PreAuthorize("@ss.hasPermi('ykb:taskAudit:query')")
    @GetMapping(value = "/detail/{serviceID}")
    public Object getInfo(@PathVariable(value = "serviceID") String serviceID) {
        return this.taskAuditService.selectTaskAuditByServiceID(serviceID);
    }

    /**
     * 删除任务-审核
     */
    @ApiOperation(value = "删除")
    @PreAuthorize("@ss.hasPermi('ykb:taskAudit:remove')")
    @Log(title = "任务-审核", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public Object remove(@PathVariable Integer[] ids) {
        return this.taskAuditService.deleteTaskAuditByTaskAuditIDs(ids);
    }
}
